// 时间戳转换方法
 export function formatDate(row, column, cellValue, index) {
    if (cellValue == null || cellValue == "") return "";
    let date = new Date(parseInt(cellValue * 1000));
    let Y = date.getFullYear() + "-";
    let M =
      date.getMonth() + 1 < 10
        ? "0" + (date.getMonth() + 1) + "-"
        : date.getMonth() + 1 + "-";
    let D =
      date.getDate() < 10 ? "0" + date.getDate() + " " : date.getDate() + " ";
    let h =
      date.getHours() < 10
        ? "0" + date.getHours() + ":"
        : date.getHours() + ":";
    let m =
      date.getMinutes() < 10
        ? "0" + date.getMinutes() + ":"
        : date.getMinutes() + ":";
    let s =
      date.getSeconds() < 10 ? "0" + date.getSeconds() : date.getSeconds();
    return Y + M + D + "" + h + m + s;
  }
//日志获取系统时间
  export function getTime(timedate) {
    var date = new Date(timedate);
    var y = date.getFullYear();
    var m = date.getMonth() + 1;
    m = m < 10 ? "0" + m : m;
    var d = date.getDate();
    d = d < 10 ? "0" + d : d;
    var h = date.getHours();
    var minute = date.getMinutes();
    minute = minute < 10 ? "0" + minute : minute;
    let time = y + "-" + m + "-" + d + " " + h + ":" + minute;
    return time;
  }

  //排序
  export function sortFun(attr, rev) {
    //第一个参数传入info里的prop表示排的是哪一列，第二个参数是升还是降排序
    if (rev == undefined) {
      rev = 1;
    } else {
      rev = rev ? 1 : -1;
    }
    return function (a, b) {
      a = a[attr];
      b = b[attr];
      if (a < b) {
        return rev * -1;
      }
      if (a > b) {
        return rev * 1;
      }
      return 0;
    };
  }